// Verilated -*- C++ -*-
// DESCRIPTION: Verilator output: Design implementation internals
// See Vtop.h for the primary calling header

#include "Vtop.h"
#include "Vtop__Syms.h"

//==========

Vtop::Vtop(VerilatedContext* _vcontextp__, const char* _vcname__)
    : VerilatedModule{_vcname__}
 {
    Vtop__Syms* __restrict vlSymsp = __VlSymsp = new Vtop__Syms(_vcontextp__, this, name());
    Vtop* const __restrict vlTOPp VL_ATTR_UNUSED = vlSymsp->TOPp;
    // Reset internal values

    // Reset structure values
    _ctor_var_reset(this);
}

void Vtop::__Vconfigure(Vtop__Syms* vlSymsp, bool first) {
    if (false && first) {}  // Prevent unused
    this->__VlSymsp = vlSymsp;
    if (false && this->__VlSymsp) {}  // Prevent unused
    vlSymsp->_vm_contextp__->timeunit(-12);
    vlSymsp->_vm_contextp__->timeprecision(-12);
}

Vtop::~Vtop() {
    VL_DO_CLEAR(delete __VlSymsp, __VlSymsp = nullptr);
}

void Vtop::_settle__TOP__2(Vtop__Syms* __restrict vlSymsp) {
    VL_DEBUG_IF(VL_DBG_MSGF("+    Vtop::_settle__TOP__2\n"); );
    Vtop* const __restrict vlTOPp VL_ATTR_UNUSED = vlSymsp->TOPp;
    // Body
    vlTOPp->io_out_Data_in = vlTOPp->top__DOT__M_Core__DOT__io_out_Data_in_REG;
    vlTOPp->io_out_Clk_in = vlTOPp->top__DOT__M_Core__DOT__the_clk_in;
    vlTOPp->io_out_Ena_out = vlTOPp->top__DOT__M_Core__DOT__io_out_Ena_out_REG;
    vlTOPp->io_out_Clk_out = vlTOPp->top__DOT__M_Core__DOT__io_out_Clk_out_REG;
    vlTOPp->io_out_Clk = vlTOPp->top__DOT__M_Core__DOT__io_out_Clk_REG_3;
    vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk_clock 
        = (1U & (~ (IData)(vlTOPp->top__DOT__M_Core__DOT__the_clock_M_Clk_Divider__DOT__the_clk)));
    vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT___count_clk_in_T_1 
        = (0xffU & ((IData)(1U) + (IData)(vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT__count_clk_in)));
    vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT___count_clk_delay_T_1 
        = (0xffU & ((IData)(1U) + (IData)(vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT__count_clk_delay)));
    vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT___count_clk_enable_T_1 
        = (0xffU & ((IData)(1U) + (IData)(vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT__count_clk_enable)));
    vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT___count_clk_out_T_1 
        = (0xffU & ((IData)(1U) + (IData)(vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT__count_clk_out)));
    vlTOPp->io_out_Ena_in = vlTOPp->top__DOT__M_Core__DOT__the_ena_in;
    vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT___T 
        = (1U == (IData)(vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__stateReg));
    vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT___T_1 
        = (2U == (IData)(vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__stateReg));
    vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT___T_2 
        = (3U == (IData)(vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__stateReg));
    vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT___GEN_3 
        = ((3U == (IData)(vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__stateReg)) 
           | (4U == (IData)(vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__stateReg)));
    vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT___GEN_13 
        = ((2U == (IData)(vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT__count_clk_enable))
            ? 4U : (IData)(vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__stateReg));
    vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT___GEN_16 
        = ((4U == (IData)(vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__stateReg))
            ? ((0x7eU == (IData)(vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT__count_clk_out))
                ? 0U : (IData)(vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__stateReg))
            : 1U);
}

void Vtop::_eval_initial(Vtop__Syms* __restrict vlSymsp) {
    VL_DEBUG_IF(VL_DBG_MSGF("+    Vtop::_eval_initial\n"); );
    Vtop* const __restrict vlTOPp VL_ATTR_UNUSED = vlSymsp->TOPp;
    // Body
    vlTOPp->__Vclklast__TOP__clock = vlTOPp->clock;
    vlTOPp->__Vclklast__TOP__reset = vlTOPp->reset;
    vlTOPp->__Vclklast__TOP____VinpClk__TOP__top__DOT__M_Clk_Divider_clk_div 
        = vlTOPp->__VinpClk__TOP__top__DOT__M_Clk_Divider_clk_div;
    vlTOPp->__Vclklast__TOP__top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk_clock 
        = vlTOPp->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk_clock;
}

void Vtop::final() {
    VL_DEBUG_IF(VL_DBG_MSGF("+    Vtop::final\n"); );
    // Variables
    Vtop__Syms* __restrict vlSymsp = this->__VlSymsp;
    Vtop* const __restrict vlTOPp VL_ATTR_UNUSED = vlSymsp->TOPp;
}

void Vtop::_eval_settle(Vtop__Syms* __restrict vlSymsp) {
    VL_DEBUG_IF(VL_DBG_MSGF("+    Vtop::_eval_settle\n"); );
    Vtop* const __restrict vlTOPp VL_ATTR_UNUSED = vlSymsp->TOPp;
    // Body
    vlTOPp->_settle__TOP__2(vlSymsp);
    vlTOPp->__Vm_traceActivity[3U] = 1U;
    vlTOPp->__Vm_traceActivity[2U] = 1U;
    vlTOPp->__Vm_traceActivity[1U] = 1U;
    vlTOPp->__Vm_traceActivity[0U] = 1U;
}

void Vtop::_ctor_var_reset(Vtop* self) {
    VL_DEBUG_IF(VL_DBG_MSGF("+    Vtop::_ctor_var_reset\n"); );
    // Body
    if (false && self) {}  // Prevent unused
    self->clock = VL_RAND_RESET_I(1);
    self->reset = VL_RAND_RESET_I(1);
    self->io_out_Data_in = VL_RAND_RESET_I(1);
    self->io_out_Ena_in = VL_RAND_RESET_I(1);
    self->io_out_Clk_in = VL_RAND_RESET_I(1);
    self->io_out_Ena_out = VL_RAND_RESET_I(1);
    self->io_out_Clk_out = VL_RAND_RESET_I(1);
    self->io_out_Clk = VL_RAND_RESET_I(1);
    self->top__DOT__M_Clk_Divider_clk_div = VL_RAND_RESET_I(1);
    self->top__DOT__M_Core__DOT__the_ena_in = VL_RAND_RESET_I(1);
    self->top__DOT__M_Core__DOT__the_clk_in = VL_RAND_RESET_I(1);
    self->top__DOT__M_Core__DOT__io_out_Data_in_REG = VL_RAND_RESET_I(1);
    self->top__DOT__M_Core__DOT__io_out_Ena_out_REG = VL_RAND_RESET_I(1);
    self->top__DOT__M_Core__DOT__io_out_Clk_out_REG = VL_RAND_RESET_I(1);
    self->top__DOT__M_Core__DOT__io_out_Clk_REG = VL_RAND_RESET_I(1);
    self->top__DOT__M_Core__DOT__io_out_Clk_REG_1 = VL_RAND_RESET_I(1);
    self->top__DOT__M_Core__DOT__io_out_Clk_REG_2 = VL_RAND_RESET_I(1);
    self->top__DOT__M_Core__DOT__io_out_Clk_REG_3 = VL_RAND_RESET_I(1);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk_clock = VL_RAND_RESET_I(1);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT__the_ena_out = VL_RAND_RESET_I(1);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT__io_out_Ena_out_REG = VL_RAND_RESET_I(1);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT__stateReg = VL_RAND_RESET_I(3);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT___T = VL_RAND_RESET_I(1);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT___T_1 = VL_RAND_RESET_I(1);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT___T_2 = VL_RAND_RESET_I(1);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT___GEN_3 = VL_RAND_RESET_I(1);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT___GEN_13 = VL_RAND_RESET_I(3);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT___GEN_16 = VL_RAND_RESET_I(3);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT__count_clk_in = VL_RAND_RESET_I(8);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT__count_clk_delay = VL_RAND_RESET_I(8);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT__count_clk_enable = VL_RAND_RESET_I(8);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT__count_clk_out = VL_RAND_RESET_I(8);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT___count_clk_in_T_1 = VL_RAND_RESET_I(8);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT___count_clk_delay_T_1 = VL_RAND_RESET_I(8);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT___count_clk_enable_T_1 = VL_RAND_RESET_I(8);
    self->top__DOT__M_Core__DOT__M_PUF_Core__DOT__M_Count_Clk__DOT___count_clk_out_T_1 = VL_RAND_RESET_I(8);
    self->top__DOT__M_Core__DOT__the_clock_M_Clk_Divider__DOT__the_clk = VL_RAND_RESET_I(1);
    self->top__DOT__M_Clk_Divider__DOT__cnt = VL_RAND_RESET_I(8);
    self->__Vdly__top__DOT__M_Core__DOT__M_PUF_Core__DOT__stateReg = VL_RAND_RESET_I(3);
    self->__VinpClk__TOP__top__DOT__M_Clk_Divider_clk_div = VL_RAND_RESET_I(1);
    self->__Vchglast__TOP__top__DOT__M_Clk_Divider_clk_div = VL_RAND_RESET_I(1);
    for (int __Vi0=0; __Vi0<4; ++__Vi0) {
        self->__Vm_traceActivity[__Vi0] = VL_RAND_RESET_I(1);
    }
}
